// Global.h: interface for the Global class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_GLOBAL_H__475A28C4_CBCE_48A7_AA49_71BBFFCE5EE7__INCLUDED_)
#define AFX_GLOBAL_H__475A28C4_CBCE_48A7_AA49_71BBFFCE5EE7__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <math.h>
#include "AcGeExt.h"
#include "TextException.h"

namespace Global  
{
	INT AFX_EXT_API CountOfSubStrings ( CONST CString& strOwner, LPCTSTR szSub );
	INT AFX_EXT_API CountOfSubStrings ( CONST CString& strOwner, TCHAR ch );
	bool AFX_EXT_API GetFilePathAndTitle( const CString& fullPath, CString& path, CString& title );
	void AFX_EXT_API SetURL( CString& url, const CString& inputurl ) throw ( TextException );
};

class DoubleWrap
{
public:
	DoubleWrap() { m_val = 0.0f; }
	~DoubleWrap() {}
	DoubleWrap( const DoubleWrap& totherDouble ) { m_val = totherDouble.m_val; }
	DoubleWrap( const double aDouble ) { m_val = aDouble; }

public:
	DoubleWrap& operator=( const DoubleWrap& totherDouble ) {
		m_val = totherDouble.m_val;
		return *this;
	}
	DoubleWrap& operator=( const double aDouble ) {
		m_val = aDouble;
		return *this;
	}
	operator double&() { return m_val; }
	double operator-( const double right ) const { return m_val - right; }
	double operator+( const double right ) const { return m_val + right; }
	bool operator==( const DoubleWrap& right ) const {
		return fabs( m_val - right.m_val ) <= AcGeExt::g_tol.equalPoint();
	}
	bool operator<( const DoubleWrap& right ) const {
		return m_val - right.m_val < -AcGeExt::g_tol.equalPoint();
	}
	bool operator<=( const DoubleWrap& right ) const {
		return m_val - right.m_val <= AcGeExt::g_tol.equalPoint();
	}
	bool operator>( const DoubleWrap& right ) const {
		return m_val - right.m_val > AcGeExt::g_tol.equalPoint();
	}
	bool operator>=( const DoubleWrap& right ) const {
		return m_val - right.m_val >= -AcGeExt::g_tol.equalPoint();
	}

private:
	double m_val;
};

#endif // !defined(AFX_GLOBAL_H__475A28C4_CBCE_48A7_AA49_71BBFFCE5EE7__INCLUDED_)
